import { request } from "@/utils/http";
import type {DoctorList,reqFindScheduleListTypes,GetScheduleparams,ScheduleRuleList,DepartmentList,ShowHospitalType,CityList, GetHospitalListParams, GetHospitalListResponse } from "./model/hospitalListtypes";


export const reqGetHospitalList = ({ page, limit, ...params }: GetHospitalListParams) => {
    // <any, string>的第一个类型为any即可，实际不会用上
    // 第二个类型是返回值数据中data的类型，根据接口文档填写
    return request.get<any, GetHospitalListResponse>(`/admin/hosp/hospital/${page}/${limit}`, {
        params,
    });
};

//省/市/区列表数据
export const reqGetCityList = (parentId:number) => {
    return request.get<any, CityList>(`/admin/cmn/dict/findByParentId/${parentId}`)
};
export const reqGetHospitalById = (Id:string) => {
    return request.get<any, ShowHospitalType>(`/admin/hosp/hospital/show/${Id}`)
};
export const reqGetDepartmentList = (hoscode:string) => {
    return request.get<any, DepartmentList>(`/admin/hosp/department/${hoscode}`)
};
export const reqGetScheduleRuleList = ({page,limit,hoscode,depcode}:GetScheduleparams) => {
    return request.get<any, ScheduleRuleList>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
};
export const reqFindScheduleList = ({hoscode,depcode,workDate}:reqFindScheduleListTypes) => {
    return request.get<any, DoctorList>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
};
export const reqUpStatus = (id:string,status:number) => {
    return request.get<any, any>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
};